package server.business.controller;


import server.business.pojo.BloodPrice;
import server.business.service.BloodOrderService;
import server.business.service.BloodPriceService;
import server.business.vo.Result;
import server.business.vo.ResultExpand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author FZX
 * @since 2022-08-06
 */
@Controller
@RequestMapping("/bloodPrice")
public class BloodPriceController {
    @Autowired
    private BloodPriceService bloodPriceService;

    /**
     * 商品列表
     *
     * @return {@link String}
     */

    /**
     *  获取所有的血液价格
     *@return
     */
    @ResponseBody
    @RequestMapping("/normal/getBloodPrice")
    public Result getBloodPrice() {
        Result result = new Result();
        result = bloodPriceService.getBloodPrice();
        return result;
    }
    
    /**
     * 获取页面
     *血液价格分页查询
     */
    @RequestMapping("/normal/listByPage")
    @ResponseBody
    public ResultExpand getPage(HttpServletRequest request, HttpServletResponse response){
        ResultExpand resultExpand = new ResultExpand();
        resultExpand = bloodPriceService.getPage(request, response);
        return resultExpand;
    }

    /**
     * 搜索血液价格
     *
     * @param request  请求
     * @param response 响应
     * @return {@link ResultExpand}
     */
    @RequestMapping("/normal/searchPrice")
    @ResponseBody
    public ResultExpand searchPrice(HttpServletRequest request, HttpServletResponse response){
        ResultExpand resultExpand = new ResultExpand();
        resultExpand = bloodPriceService.searchPrice(request, response);
        return resultExpand;
    }

    /**
     * 下载excel
     *
     * @param request  请求
     * @param response 响应
     */
    @RequestMapping("/normal/downloadExcel")
    public void downloadExcel(HttpServletRequest request, HttpServletResponse response){
        bloodPriceService.downloadExcel(request, response);
    }

}

